import Config from '@/config';
import Http from '@/utils/httpRequest';
// const WXBizDataCrypt = require('@/utils/WXBizDataCrypt');

const { xcxApis, xcxWeixins } = Config;
const APP_ID = 'wxbf74562acfd4972e';
const APP_SECRET = '4d82c26f58372c59fdf5c474015ff3ca';
// 微信认证获取token
export const wxGetToken= (code) => {
    return Http.request(`${xcxWeixins}/cgi-bin/token?grant_type=client_credential&appid=${APP_ID}&secret=${APP_SECRET}`);
}
// 通过token获取手机号
export const wxGetUserPhoneNumber = (access_token, body) => {
    return Http.request(`${xcxWeixins}/wxa/business/getuserphonenumber?access_token=${access_token}`, body, 'post');
}
// 用户登录
export const userLogin = (body) => {
    return Http.request(`${xcxApis}/login`, body, 'post');
}
// 通过手机号获取用户信息
export const getByUserPhone = (phone) => {
    return Http.request(`${xcxApis}/system/user/getByUserPhone?phone=${phone}`);
}
// 获取权限
export const getByUserId = (userId) => {
    return Http.request(`${xcxApis}/system/user/getByUserId?userId=${userId}`);
}
